<!DOCTYPE html>
<html>
<head>
    <title>微服务管理中心</title>
    <#import "../common/common.macro.ftl" as netCommon>
    <@netCommon.commonStyle />
    <!-- DataTables -->
    <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css">
    <!-- daterangepicker -->
    <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.css">
</head>
<body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && cookieMap["adminlte_settings"]?exists && "off" == cookieMap["adminlte_settings"].value >sidebar-collapse</#if> ">
<div class="wrapper">
    <!-- header -->
    <@netCommon.commonHeader />
    <!-- left -->
    <@netCommon.commonLeft "env" />

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>服务管理</h1>
        </section>

        <!-- Main content -->
        <section class="content">

            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
<#--                        <div class="box-header">-->
<#--                            <h3 class="box-title">服务列表</h3>&nbsp;&nbsp;-->
<#--                        </div>-->
                        <div class="box-body">
                            <table id="joblog_list" class="table table-bordered table-striped display" width="100%">
                                <thead>
                                <tr>
                                    <th>Id</th>
                                    <th>Env</th>
                                    <th>服务key</th>
                                    <th>服务ip</th>
                                    <th>端口</th>
                                    <th>用户</th>
                                    <th>密码</th>
                                    <th>活跃时间</th>
                                    <th>权重</th>
                                    <th>状态</th>
                                    <#if LY_CLOUD_LOGIN_IDENTITY.permission == 1>
                                        <th>操作</th>
                                    </#if>
                                </tr>
                                </thead>
                                <tbody>
                                <#if list?exists && list?size gt 0>
                                    <#list list as item>
                                        <tr>
                                            <td width="5%">${item.id}</td>
                                            <td width="5%">${item.env}</td>
                                            <td width="15%">${item.app}</td>
                                            <td width="10%">${item.serverIp}</td>
                                            <td width="5%">${item.serverPort}</td>
                                            <td width="10%">${item.user}</td>
                                            <td width="15%">${item.userPassword}</td>
                                            <td width="20%">${item.active}</td>
                                            <td width="5%">${item.weight}</td>
<#--                                            <td width="5%">${item.status}</td>-->
<#--                                            <td width="5%">${(item.status ==1)?string('启用','禁用')}</td>-->
                                            <td width="5%">
                                                <#if item.status lt 1 >
                                                禁用
                                                <#else>
                                                启用
                                                </#if>
                                            </td>
                                            <#if LY_CLOUD_LOGIN_IDENTITY.permission == 1>
                                                <td width="5%">
                                                    <button class="btn btn-warning btn-xs update" thisId="${item.id}"
                                                            thisApp="${item.app}" thisEnv="${item.weight}" thisStatus="${item.status}">编辑
                                                    </button>
                                                </td>
                                            </#if>
                                        </tr>
                                    </#list>
                                </#if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <!-- 更新.模态框 -->
    <div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog ">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">编辑服务</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal form" role="form">
                        <label>
                            <input type="text" name="id" hidden="hidden">
                        </label>
                        <div class="form-group">
                            <label for="lastname" class="col-sm-2 control-label">服务key<font color="red">*</font></label>
                            <div class="col-sm-10"><input type="text" class="form-control" name="app" readonly></div>
                        </div>
                        <div class="form-group">
                            <label for="lastname" class="col-sm-2 control-label">权重<font color="red">*</font></label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="weight" placeholder="请输入权重">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="firstname" class="col-sm-2 control-label">状态</label>
                            <div class="col-sm-10">
                                <select class="form-control" name="status" >
                                    <option value="0" >禁用</option>
                                    <option value="1" >启用</option>
                                </select>
                            </div>
                        </div>
                        <hr>
                        <div class="form-group">
                            <div class="col-sm-offset-3 col-sm-6">
                                <button type="submit" class="btn btn-primary">保存</button>
                                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- footer -->
    <@netCommon.commonFooter />
</div>

<@netCommon.commonScript />
<!-- DataTables -->
<script src="${request.contextPath}/static/adminlte/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script src="${request.contextPath}/static/js/server.index.1.js"></script>
</body>
</html>
